#include "MeasurementAlgorithmButton.h"
#include "ui_MeasurementAlgorithmButton.h"
#include <QPixmap>
#include <QEvent>

MeasurementAlgorithmButton::MeasurementAlgorithmButton(QWidget *parent)
    : QPushButton(parent)
    , ui(new Ui::MeasurementAlgorithmButton)
{
    // 初始化UI
    ui->setupUi(this);

    // 设置为可选中的按钮样式
   setCheckable(true);

}

MeasurementAlgorithmButton::~MeasurementAlgorithmButton()
{
    delete ui;
}

void MeasurementAlgorithmButton::setText(const QString &text)
{
    ui->textLabel->setText(text);
}

void MeasurementAlgorithmButton::setIcon(const QString &iconPath)
{
    QPixmap pixmap(iconPath);
    if (!pixmap.isNull()) {
        ui->iconLabel->setPixmap(pixmap.scaled(20, 20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    }
}

